package com.sunriz.motordrive.controller.photoThermal.motor;

import com.sunriz.motordrive.domain.DTO.MotorParamDTO;
import com.sunriz.motordrive.domain.DTO.Result;
import com.sunriz.motordrive.domain.DTO.SetValueDTO;
import com.sunriz.motordrive.server.photoThermal.MotorParamServer;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * ClassName: GetParamController
 * Package: com.sunriz.motordrive.controller
 * Description:
 *
 * @Author BuTang
 * @Create 2024/4/29 11:09
 * @Version 1.0
 */
@Slf4j
@RestController
@RequestMapping("/motor")
public class MotorParamController {

    @Autowired
    private MotorParamServer motorParamServer;

    @GetMapping("/getRead")
    public Result getOnlyReadData(){
        Result result = motorParamServer.getOnlyReadData();
        return result;
    }

    @GetMapping("/getReadAndWrite")
    public Result getReadAndWrite(){
        Result result = motorParamServer.getReadAndWrite();
        return result;
    }



    @GetMapping("/getData")
    public Result getData(@RequestParam String slaveId){
        Result result = motorParamServer.getData(slaveId);
        return result;
    }

    @PutMapping("/setValue")
    public Result setValue(@RequestBody SetValueDTO setValueDTO){
        motorParamServer.setValue(setValueDTO);
        return Result.success();
    }

}







